var slideShow2_timeOutId;
var slideShow2_directory;
var slideShow2_speed;
var slideShow2_postLeft;
var slideShow2_imgThum;
var slideShow2_imgPreview;
var slideShow2_tableThumb;

function slideShow2_showPreview(url, control)
{	
	if (slideShow2_imgPreview)
	{
		slideShow2_imgPreview.innerHTML = '<img src="' + slideShow2_directory + url + '" />';
		slideShow2_setCurrentImage(control);
	}
}
function slideShow2_setCurrentImage(control)
{
	if (control.nodeName.toLowerCase() == 'img')
	{
		var parentNode = control.parentNode.parentNode;
		var images = parentNode.getElementsByTagName(control.nodeName);
		for (var i=0; i<images.length; i++)
		{
			images[i].height = '80';
			images[i].style.border = '';
		}
		
		control.height = '87';
		control.style.border = 'solid 2px red';
	}
}

function slideShow2_increaseLeftPost()
{
	if (slideShow2_speed != 0)
	{
		if (slideShow2_speed>0 && slideShow2_postLeft >= 0) 
		{
			slideShow2_speed = 0;
			slideShow2_postLeft = 0;
		}
		if (slideShow2_speed<0 && slideShow2_postLeft <= -1*(slideShow2_imgThum.offsetWidth - 380))
		{
			slideShow2_speed = 0;
			slideShow2_postLeft = -1*(slideShow2_imgThum.offsetWidth - 380)
		}
		
		slideShow2_postLeft += slideShow2_speed;
		slideShow2_imgThum.style.left = slideShow2_postLeft + 'px';
		
	}
	slideShow2_timeOutId = setTimeout('slideShow2_increaseLeftPost()',20);
}
function slideShow2_setFirstImage()
{
	// preview first image
	if (slideShow2_imgThum)
	{
		var img, imgs = slideShow2_imgThum.getElementsByTagName('img');
		if (imgs.length > 0)
		{
			slideShow2_imgPreview.innerHTML = '<img src="' + imgs[0].title + '" />';
			slideShow2_setCurrentImage(imgs[0]);
		}
	}
}